package com.example.administrator.displayandhide;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
   private Button btn1;
   private Button btn2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn1=findViewById(R.id.btn_1);
        btn2=findViewById(R.id.btn_2);
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //显示调用1
               /* Intent intent=new Intent();
                intent.setClass(MainActivity.this,ActivityB.class);
                startActivity(intent);*/
                //显示调用2
                /*Intent intent1=new Intent();
                intent1.setClassName("com.example.administrator.displayandhide",
                        "com.example.administrator.displayandhide.ActivityB");
                startActivity(intent1);*/
                //显示调用3
               /* Intent intent2=new Intent();
                intent2.setClassName(MainActivity.this,
                        "com.example.administrator.displayandhide.ActivityB");
                startActivity(intent2);*/
            }
        });
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent();
               /* intent.setAction(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http//www.baidu.com"));*/
                intent.setAction("i_want_eat");
                intent.addCategory("ja_pa_fan");
                startActivity(intent);
            }
        });
    }
}
